﻿<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport"
	content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
<title>未来科技</title>

<link href="css/bootstrap.min.css" title="" rel="stylesheet" />
<link title="orange" href="css/login.css" rel="stylesheet" type="text/css">
</head>

<body>

	<div style="height: 1px;"></div>
	<div class="login">
		<header>
			<h1>未来科技</h1>
		</header>
		<div class="sr">
			<form action="">
				<div class="name">
					<label> <i class="sublist-icon glyphicon glyphicon-user"></i>
					</label> <input type="text" placeholder="登录名" class="name_inp"
						name="loginname" value="wu">
				</div>
				<div class="name">
					<label> <i class="sublist-icon glyphicon glyphicon-pencil"></i>
					</label> <input type="text" placeholder="登录密码" class="name_inp"
						name="password" value="123">
				</div>
				<input type="button" class="dl" value="登录">
			</form>
		</div>
	</div>
</body>


<script type="text/javascript" src="js/jquery.js"></script>

<script type="text/javascript">
	$(function() {
		$(".dl").on("click", function() {
			pass();
		})
	})
	/**
	 * 审批通过按钮
	 */
	function pass(row, passstatus) {
		$.ajax({
			type : "POST",
			url : 'http://localhost:8080/springmybatis/login.do',
			dataType : 'json',
			data : JSON.stringify({
				"username" : $(".sr input[name='loginname']").val(),
				"password" : $(".sr input[name='password']").val()
			}),
			contentType : "application/json;charset=utf-8",
			error : function(msg) {
				debugger;
				
			},
			success : function(data) {
				debugger;
				 if (data.code == '1') {
					window.location.href = "main.do";
				} else {
					alert("密码错误，请确认后重新登录！");
				}
			}
		});
	}
</script>
</html>

